package com.boot.mgt.controller.app

import com.boot.core.result.ResultTo
import com.boot.mgt.service.TaDistrictService
import com.boot.mgt.service.TaStreetService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@RequestMapping("/app/address")
class TaAddressController {

    @Autowired
    private lateinit var districtService: TaDistrictService

    @Autowired
    private lateinit var streetService: TaStreetService

    /**
     *获取行政区域
     */
    @GetMapping("/district")
    fun district(): ResultTo {
        return districtService.selectAll()
    }

    /**
     *获取街道
     */
    @GetMapping("/street")
    fun street(district_id: Int): ResultTo {
        return streetService.select(district_id)
    }

}